<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>修改资料</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/mui.picker.min.css" />
		
		
		<style>
			h5 {
				margin: 5px 7px;
			}
			[v-cloak] {
			  display: none;
			}
			
					
			.mui-input-row .mui-btn {
			    line-height: 1.1;
			    float: right;
			    width:55%;
			    padding: 10px 15px;
			}
			
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">修改资料</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded" style="margin: 5px;">
				
				<form class="mui-input-group" id="fmInput">
					<div class="mui-input-row" v-cloak>
						<label>手机号:</label>
						<label>{{fmUser.mobileold}}</label>
					</div>
					<div class="mui-input-row">
						<label>新手机号:</label>
						<input type="text" placeholder="请输入" id="txtMobile" v-model="fmUser.mobile" maxlength="15"/>
					</div>
					<div class="mui-input-row" style="height: 50px;">
						<label>再输一次<br>新手机号:</label>
						<input type="text" placeholder="请输入" id="txtMobile2" v-model="fmUser.mobile2" maxlength="15"/>
					</div>
					
					<div class="mui-input-row">
						<label>名称:</label>
						<input type="text" placeholder="请输入" id="txtUserTitle" v-model="fmUser.usertitle" maxlength="50"/>
					</div>
					
					<div class="mui-input-row">
						<label>性别:</label>
						<select class="mui-btn mui-btn-block" v-model="fmUser.sex">
							<option value="男">男</option>
							<option value="女">女</option>
						</select>
					</div>
					
					<div class="mui-button-row">
						<button type="button" id="butSave" class="mui-btn mui-btn-primary" >确认</button>&nbsp;&nbsp;
						<button type="button" id="butCancel" class="mui-btn mui-btn-danger" >取消</button>
					</div>
					
				</form>
				
				
			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/tools.js"></script>
		<script>
			var theVue;
			
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			
			(function($) {
				$.init();
				//var result = $('#result')[0];
				
				
			})(mui);
			
			document.getElementById("butCancel").addEventListener('tap', function(e) 
			{
				mui.back();
			});
			
					
			
			document.getElementById("butSave").addEventListener('tap', function(e) 
			{
				//alert(theVue.fmWorkshop.state);
				
				//return;
				
				if(theVue.fmUser.mobile.trim() == "")
				{
					mui.toast("请输入新手机号");
					return;
				}
				
				if(theVue.fmUser.mobile2.trim() == "")
				{
					mui.toast("请再次输入新手机号");
					return;
				}
				
				if(theVue.fmUser.mobile2.trim() != theVue.fmUser.mobile.trim())
				{
					mui.toast("两次输入的新手机号不同");
					return;
				}
				
				if(theVue.fmUser.usertitle.trim() == "")
				{
					mui.toast("请输入正确真实名称");
					return;
				}
				
				
				sespost('/zdm/AppApi/UserAuth/PerfectUserInfo',
				theVue.fmUser,
				function(retData)
				{
					if(retData.succ == 1)
					{
						mui.toast("保存成功");
						mui.back();
					}
					else
					{
						mui.toast("保存失败");
						mui.back();
					}
					
				});
				
				
			});


		</script>
		
		<script>
		theVue = new Vue({
		    el:'#fmInput',
		    data:
		    {
			    fmUser:
			    {
				}
				
		    }
		    
		});
		
	function loadData()
	{
		sespost('/zdm/AppApi/UserAuth/GetCurUserInfo',
		{},
		function(retData)
		{
			retData.mobile2 = "";
			retData.mobileold = retData.mobile;
			theVue.fmUser = retData;
//			theVue.fmUser.mobileold = "retData.mobile";
//			theVue.fmUser.mobile = retData.mobile;
//			theVue.fmUser.sex = retData.sex;
//			theVue.fmUser.usertitle = retData.usertitle;
		});
	}	
	
	loadData();
		</script>
		
			
	</body>

</html>